package com.gitee.yannzh.rune.support.crud.annotation;


import com.gitee.yannzh.rune.support.crud.query.Condition;
import com.gitee.yannzh.rune.support.crud.query.Operator;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author Yann
 * @description 构造查询条件注解
 * @date 2023-12-25
 */
@Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Query {

    /**
     * 查询条件
     */
    Condition condition() default Condition.EQ;


    /**
     * 如果Query对象字段与对应Entity字段不一致，填写Entity字段名称
     */
    String property() default "";

    /**
     * 连接符 默认AND
     *
     * @return Operator
     */
    Operator operator() default Operator.AND;

    /**
     * 参数为空时是否查询
     *
     * @return
     */
    boolean empty() default false;

    /**
     * 查询参数处理器
     *
     */
//    Class<? extends QueryParamHandler> handler() default DefaultQueryParamHandler.class;

}